#pragma once
#include <string>
#include <cstddef> 
#include <odb/nullable.hxx>
#include <odb/core.hxx>

// odb -d mysql --std c++11 --generate-query --generate-schema --profile boost/date-time relation.hxx
namespace xchat
{

#pragma db object table("relation")
class Relation
{
public:
    Relation() {}
    //用户名--新增id -- 用户ID 昵称 密码
    Relation(const std::string &user_id, const std::string &peer_id)
        :   _user_id(user_id), _peer_id(peer_id)
    {}
    
    std::string user_id() const { return _user_id; }
    void user_id(const std::string &val)  { _user_id = val; }
    
    std::string peer_id() const { return _peer_id; }
    void peer_id(const std::string &val)  { _peer_id = val; }

private:
    friend class odb::access;

    #pragma db id auto
    unsigned long _id;


    #pragma db type("varchar(64)") index //用户与好友多对多 可重复
    std::string _user_id;
    #pragma db type("varchar(64)") 
    std::string _peer_id;

};

} // namespace xchat